const Mock = require('mockjs')

const data = Mock.mock({
    'items|30': [{
        index: '@increment',   //序号
        id: '@integer(1000000, 9999999)',    //业主编号
        proprietor: () => {                                                       
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //业主名称
        address: '@integer(1000000, 9999999)',    //表计地址
        basic_cost: '@integer(10, 999)',   //基本费用
        time_frame: '@integer(100000000000, 999999999999)',    //时段名称
        previous: '@integer(100000000000, 999999999999)',     //上期读书
        current: '@integer(10, 99999)' + 'kw',    //本期用量
        unit_price: '@float(0, 99, 1, 2)',   //计量单价
        use_expense: '@integer(10, 999)',    //使用费用
        total_cost: '@integer(10, 999)',     //总费用
        display_time: '@datetime',    //缴费期间
    }]
})
module.exports = [
    {
        url: '/vue-admin-template/dataManage/check',
        type: 'get',
        response: config => {
            const items = data.items
            return {
                code: 20000,
                data: {
                    total: items.length,
                    items: items
                }
            }
        }
    }
]
